/*
 * @Author: MrDotYan 2564217790@qq.com
 * @Date: 2024-09-12 16:03:00
 * @LastEditors: MrDotYan 2564217790@qq.com
 * @LastEditTime: 2024-09-14 10:40:18
 * @FilePath: /webServerAdmin/src/api/modules/files.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import http from "@/api";
import { PORT1 } from "@/api/config/servicePort";
import { Id, Ids, ReqPage } from "../interface";
import { FileSchema, ProcessFilesSchema } from "@/schema";

export function fetchFileList(data: ReqPage) {
  return http.post<FileSchema>(`${PORT1}/file/list`, data);
}

export function saveFile(data: FileSchema) {
  return http.post<FileSchema>(`${PORT1}/file/save`, data);
}

export function editFile(params: Id, data: FileSchema) {
  return http.put<FileSchema>(`${PORT1}/file/edit`, data, { params });
}

export function fetchFileInfo(params: Id) {
  return http.get<FileSchema>(`${PORT1}/file/info`, params);
}

export function removeFile(params: Id) {
  return http.delete<FileSchema>(`${PORT1}/file/remove`, params);
}

export function mergePdfFiles(data: Ids) {
  return http.post<ProcessFilesSchema>(`${PORT1}/process_files/merge_pdf`, data);
}

export function fetchMergePdfList(data: ReqPage) {
  return http.post<Array<ProcessFilesSchema>>(`${PORT1}/process_files/list`, data);
}
